VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClsPermiso"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public WithEvents orset As ClsRecordset
Attribute orset.VB_VarHelpID = -1

Public Event DataChanged()

Public codigo As String
Public menunombre As String
Public codTipoUsuario As String
Public codTipoServicio As String

Private Sub Class_Initialize()
    Set orset = New ClsRecordset
    orset.setCampos dbCampos(per)
    orset.setTablas Array(per)
End Sub
Private Sub Class_Terminate()
    Set orset = Nothing
End Sub
Public Sub consulta(tusCod As String, tipo As String)
    Select Case tipo
        Case "menu":
            orset.consulta Array(per_tus_id & "=" & tusCod, per_menunombre & " IS NOT NULL")
        Case "tiposervicio":
            orset.consulta Array(per_tus_id & "=" & tusCod, per_tse_id & " IS NOT NULL")
    End Select
End Sub
Public Sub consultaDatos(codig As String)
    orset.consulta Array(per_id & "=" & codig)
    orset.CierraRec
End Sub
Public Sub borrarDeTipoUsuario(tusCod As String)
    orset.sDelete Array(per_tus_id & "=" & tusCod)
End Sub

Public Sub Nuevo(newMenuNombre As String, newCodTipoUsuario As String, newCodTipoServicio As String)
    orset.sInsert Array("", newCodTipoUsuario, newMenuNombre, newCodTipoServicio)
End Sub
Public Sub Modificar(codig As String, newMenuNombre As String, newCodTipoUsuario As String, newCodTipoServicio As String)
    orset.sUpdate Array(codig, newCodTipoUsuario, newMenuNombre, newCodTipoServicio)
End Sub
Public Sub Borrar(codig As String)
    orset.sDelete Array(cli_id & "='" & codig & "'")
End Sub

Private Sub Reload_members()
    With orset
        codigo = .getDato(per_id)
        menunombre = .getDato(per_menunombre)
        codTipoUsuario = .getDato(per_tus_id)
        codTipoServicio = .getDato(per_tse_id)
    End With
    RaiseEvent DataChanged
End Sub

Private Sub orset_DataChanged()
    Reload_members
End Sub
